<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class InitUpdate20 extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('activities', function (Blueprint $table) {
            $table->integer('session_total')->default(1)->comment('一共的周期数');
            $table->integer('current_session')->default(1)->comment('当前进行的周期');
        });

        Schema::table('activity_skus', function (Blueprint $table) {
            $table->integer('per_session_stock')->nullable()->comment('每期发放的数量');
        });

        Schema::table('activity_lottery_ticket', function (Blueprint $table) {
            $table->integer('session')->default(1)->index()->comment('每几期');
        });

        Schema::table('activity_records', function (Blueprint $table) {
            $table->integer('session')->default(1)->index()->comment('每几期');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('activities', function (Blueprint $table) {
            $table->dropColumn('session_total');
            $table->dropColumn('current_session');
        });

        Schema::table('activity_skus', function (Blueprint $table) {
            $table->dropColumn('per_session');
        });

        Schema::table('activity_lottery_ticket', function (Blueprint $table) {
            $table->dropColumn('session');
        });

        Schema::table('activity_records', function (Blueprint $table) {
            $table->dropColumn('session');
        });
    }
}
